package homework;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class Demo1 {
    public static void main(String[] args) throws IOException {
        File file = new File("Day05\\src\\homework\\DemoTxt");
        System.out.println("删除结果:" + myDelete(file));
    }

    private static boolean myDelete(File file) {
        if (!file.exists())
            return false;
        if (file.isDirectory()) {
            File[] files = file.listFiles();
            if (files == null || files.length == 0)
                return false;
            for (File f : files) {
                if (!myDelete(f))
                    return false;
            }
        }
        return file.delete();
    }
}
